<style>
    table.table-form-title{margin:20px auto 0;}
    table.table-form-title td{text-align: center;border-bottom:0 !important;}
    table.table{width:90%;margin:0 auto;}
    table.table-form-attach{margin-bottom:100px;}
    .opinion-list li{margin-bottom:10px;}
    .opinion-list .line1,.opinion-list .line2{line-height:24px;}
    .opinion-list .author, .opinion-list .time{margin-right:10px;}
</style>
<div style="margin:0 auto;">
    <table class="table-form-title table" style="margin-top:20px;">
        <tr>
            <td colspan="4" style="border-bottom: 0 !important;">
                <h2>${config.getKey("COMPANY_NAME")}</h2>
                <h2>${bpmTaskFrom.fromName}</h2>
                <input type="hidden" name="processInstanceId" value="${bpmForm.processInstanceId}" />
            </td>
        </tr>

    </table>
    <table class="table-form-head table table-hover table-bordered">
        <tr>
            <th>发起部门</th>
            <td>
                <@f.input readonly=true value="${bpmForm.initiateDepartment}" readonly=true name="initiateDepartment" placeholder="请输入发起部门" required=true/>
            </td>
            <th>登记日期</th>
            <td>

                <input class="form-control" name="createTime"  value="${bpmForm.createTime?string('yyyy-MM-dd')}" type="text" readonly="readonly"   >

            </td>
        </tr>
        <tr>
            <th>项目档案编号</th>
            <td colspan="3">
                <@f.input readonly=true value="${bpmForm.projectId}" readonly=true name="projectId" placeholder="请输入项目档案编号" required=true/>
            </td>
        </tr>
        <tr>
            <th>项目名称</th>
            <td colspan="3">
                <@f.input readonly=true value="${bpmForm.projectName}" readonly=true name="projectName" placeholder="请输入项目名称" required=true/>
            </td>
        </tr>
        <tr>
            <th>委托单位</th>
            <td colspan="3">
                <@f.input readonly=true value="${bpmForm.clientCompany}" readonly=true name="clientCompany" placeholder="请输入委托单位" required=true/>
            </td>
        </tr>
        <tr>
            <th>有无地质施工</th>
            <td>
                ${dict.getLabel('sys_yes_no', bpmForm.type)}
            </td>
        </tr>
        <tr>
            <th>项目经理</th>
            <td>
                <@f.input readonly=true value="${bpmForm.projectAdmin}" readonly=true name="projectAdmin" placeholder="请输入项目经理" required=true/>
                </td>
            <th>项目所属部门</th>
            <td>
                <@f.input readonly=true name="projectDept" value="${bpmForm.projectDept}" placeholder="请输入项目所属部门" required=true/>
            </td>
        </tr>

    </table>
    <table class="table-form-body table table-hover table-bordered">
        <thead>
        <tr>
            <td colspan="9">
                <button name="btn-insert" type="button" class="btn btn-primary btn-rounded btn-sm">插入行</button>
                <button name="btn-copy" type="button" class="btn btn-primary btn-rounded btn-sm">复制行</button>
                <button name="btn-del" type="button" class="btn btn-primary btn-rounded btn-sm">删除行</button>
                <button name="btn-del-all" type="button" class="btn btn-primary btn-rounded btn-sm">删除全部</button>
                <button name="btn-import" type="button" class="btn btn-primary btn-rounded btn-sm">导入数据</button>

            </td>
        </tr>
        <tr>
            <th width="10%">序号</th>
            <th>分类</th>
            <th>项目类别</th>
        </tr>
        </thead>

        <tbody name="items">
        <tr data-id="">
            <td ><span>1 </span></td>
            <td  style="width: 30%" >
                <@f.select  name="classify" dictType="sys_bpm_classify" blankValue="" blankLabel="请选择分类"/>
            </td>
            <td>
                <@f.select  name="projectType" dictType="sys_bpm_type" blankValue="" blankLabel="请选择项目类别"/>
            </td>



        </tr>
        </tbody>
    </table>
    <table class="table-form-body table table-hover table-bordered">
        <thead>
        <tr>
            <td colspan="9">
                <button name="btn-insert" type="button" class="btn btn-primary btn-rounded btn-sm">插入行</button>
                <button name="btn-copy" type="button" class="btn btn-primary btn-rounded btn-sm">复制行</button>
                <button name="btn-del" type="button" class="btn btn-primary btn-rounded btn-sm">删除行</button>
                <button name="btn-del-all" type="button" class="btn btn-primary btn-rounded btn-sm">删除全部</button>
                <button name="btn-import" type="button" class="btn btn-primary btn-rounded btn-sm">导入数据</button>

            </td>
        </tr>
        <tr>
            <th width="10%">序号</th>
            <th width="20%">文件类别</th>
            <th width="25%">文件内容</th>
            <th width="20%">附件</th>
            <th width="25%">备注</th>

        </tr>
        </thead>

        <tbody name="items1">
        <tr data-id="">
            <td ><span>1 </span></td>
            <td><@f.select  name="fileType" dictType="sys_bpm_type" blankValue="" blankLabel="请选择文件类别"/>
            </td>
            <td ><@f.select name="fileContent" dictType="sys_bpm_content" blankLabel="请选择文件内容" blankValue=""  /></td>

            <td> <input type="hidden" name="bidedNoticeName" value="" />
                <input type="hidden" name="bidedNoticeUrl" value="" />
                <input type="file" id="file" name="file" style="display:none;" />
                <div class="pull-left">
                    <a target="_blank" name="bidedNoticeBox" href=""></a>
                </div>
                <div class="pull-right"><a onclick="showFileDlg();" href="javascript:void(0);"><i class="fa icon-link"></i></a></div>
            </td>
            <td><@f.input name="openDepartment_1" value="" placeholder="备注" /></td>
        </tr>
        </tbody>
    </table>
    <table class="table-form-head table table-hover table-bordered">
        <tr>
            <th width="10%">处理意见</th>
            <td >
                <@f.input  name="opinion" value="" placeholder="请输入处理意见" required=true/>
            </td>
        </tr>

    </table>


</div>
<script type="text/javascript">

    function tableCallback(id, event, index, layero, nodes){
        console.log("aaaaaaaaaaaaaaa")
        if(id == "initiateDepartment"){
            console.log("弹出表格选择===>>>>: id:" + id + "  event:" + event + " index:" + index + "  layero:"+ layero + " nodes:" + JSON.stringify(nodes));
            console.log(nodes.table[0]);
            var data = nodes.table[0];
            console.log(data)
            console.log(data.department);
            console.log(data.ceoName);
            $("input[name=projectDept]").val(data.department);
            $("input[name=projectName]").val(data.projectName);
            $("input[name=projectAdmin]").val(data.ceoName);
            $("input[name=clientCompany]").val(data.contractFirst);
        }
    }


    $("button[name=btn-insert]").click(function () {
        var target = $(this).closest("table").find("tbody");
        var index = target.children().length + 1;
        var tpl = $(target.children().get(0)).prop("outerHTML");
        tpl = tpl.replaceAll("1", index);
        target.append(tpl);
    });
    $("button[name=btn-del]").click(function () {
        var target = $(this).closest("table").find("tbody");
        var index = target.children().length - 1;
        if(index>0){
            target.children().get(index).remove();
        }
    });
    $("button[name=btn-del-all]").click(function () {
        var target = $(this).closest("table").find("tbody");
        var index = target.children().length - 1;
        for(var i=index; i>0; i--){
            target.children().get(i).remove();
        }
    });
</script>